/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import arquivos.Arquivos;
import entidades.Aluno;
import entidades.Controlador;
import entidades.Fila;
import entidades.ListaCircular;
import entidades.ListaDupla;
import entidades.ListaSimples;
import entidades.Pilha;
import java.awt.CardLayout;
import java.util.ArrayList;
import java.util.Collection;
import javax.swing.JOptionPane;

/**
 *
 * @author luciano
 */
public class TelaPrincipal extends javax.swing.JFrame {

    Arquivos arquivos = new Arquivos();
    ListaSimples listaSimples = new ListaSimples();
    Pilha pilha = new Pilha();
    ListaDupla listadupla = new ListaDupla();
    ListaCircular listacircular = new ListaCircular();
    Fila fila = new Fila();
    Controlador control = new Controlador();
    private int opcao;
    //private int opcao, posicao;
    String nome;

    public TelaPrincipal() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        Root = new javax.swing.JPanel();
        Inicio = new javax.swing.JPanel();
        jButton19 = new javax.swing.JButton();
        ListaSimples = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        tf_principal_listasimples = new javax.swing.JTextField();
        salva_simples = new javax.swing.JButton();
        cancel_simples = new javax.swing.JButton();
        ls_radio_inicio = new javax.swing.JRadioButton();
        ls_radio_fim = new javax.swing.JRadioButton();
        ls_radio_posi = new javax.swing.JRadioButton();
        tf_listasimples_posicao = new javax.swing.JFormattedTextField();
        ListaDupla = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        tf_listadupla = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        text_posic_dupla = new javax.swing.JTextField();
        check_ls_dupla_inicio = new javax.swing.JRadioButton();
        check_ls_dupla_fim = new javax.swing.JRadioButton();
        salva_dupla = new javax.swing.JButton();
        cancel_dupla = new javax.swing.JButton();
        remove_dupla = new javax.swing.JButton();
        check_ls_dupla_posi = new javax.swing.JRadioButton();
        Pilha = new javax.swing.JPanel();
        salvar_piha = new javax.swing.JButton();
        cancel_pilha = new javax.swing.JButton();
        jLabel7 = new javax.swing.JLabel();
        tf_pilha = new javax.swing.JTextField();
        remove_pilha = new javax.swing.JButton();
        Fila = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        tf_fila = new javax.swing.JTextField();
        salvar_fila = new javax.swing.JButton();
        cancel_fila = new javax.swing.JButton();
        remove_fila = new javax.swing.JButton();
        ListaCircular = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        tf_circular = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        cancel_circular = new javax.swing.JButton();
        circular_salvar = new javax.swing.JButton();
        tf_circular_pos = new javax.swing.JFormattedTextField();
        SalvarEstrutura = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        tf_salvarestrutura = new javax.swing.JTextField();
        check_listasimples = new javax.swing.JCheckBox();
        check_listadupla = new javax.swing.JCheckBox();
        check_circular = new javax.swing.JCheckBox();
        check_pilha = new javax.swing.JCheckBox();
        check_fila = new javax.swing.JCheckBox();
        salvar_salvarestrutura = new javax.swing.JButton();
        cancel_salvarestrutura = new javax.swing.JButton();
        check_bolha = new javax.swing.JCheckBox();
        check_quick = new javax.swing.JCheckBox();
        check_inserton = new javax.swing.JCheckBox();
        check_selection = new javax.swing.JCheckBox();
        Exibe = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabela = new javax.swing.JTable();
        abrir_elemento = new javax.swing.JButton();
        Exibe_Arquivos = new javax.swing.JPanel();
        janela = new javax.swing.JFileChooser();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu_Cria = new javax.swing.JMenu();
        jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jMenu3 = new javax.swing.JMenu();
        princ_listasimples = new javax.swing.JRadioButtonMenuItem();
        princ_listadupla = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem();
        jMenu2_Salva = new javax.swing.JMenu();
        jRadioButtonMenuItem6 = new javax.swing.JRadioButtonMenuItem();
        jMenu_esvazia = new javax.swing.JMenu();
        jRadioButtonMenuItem7 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem8 = new javax.swing.JRadioButtonMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jRadioButtonMenuItem9 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem10 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem11 = new javax.swing.JRadioButtonMenuItem();
        Menu_Exibe = new javax.swing.JMenu();
        Menu_exibe_todos = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        Root.setToolTipText("");
        Root.setLayout(new java.awt.CardLayout());

        jButton19.setText("Sair");
        jButton19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton19ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout InicioLayout = new javax.swing.GroupLayout(Inicio);
        Inicio.setLayout(InicioLayout);
        InicioLayout.setHorizontalGroup(
            InicioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, InicioLayout.createSequentialGroup()
                .addContainerGap(344, Short.MAX_VALUE)
                .addComponent(jButton19)
                .addGap(20, 20, 20))
        );
        InicioLayout.setVerticalGroup(
            InicioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(InicioLayout.createSequentialGroup()
                .addContainerGap(338, Short.MAX_VALUE)
                .addComponent(jButton19)
                .addContainerGap())
        );

        Root.add(Inicio, "Inicio");

        jLabel3.setText("Nome");

        tf_principal_listasimples.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tf_principal_listasimplesActionPerformed(evt);
            }
        });

        salva_simples.setText("Salvar");
        salva_simples.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salva_simplesActionPerformed(evt);
            }
        });

        cancel_simples.setText("Cancelar");
        cancel_simples.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_simplesActionPerformed(evt);
            }
        });

        buttonGroup1.add(ls_radio_inicio);
        ls_radio_inicio.setText("Inicio");

        buttonGroup1.add(ls_radio_fim);
        ls_radio_fim.setText("Fim");

        buttonGroup1.add(ls_radio_posi);
        ls_radio_posi.setText("Posição");

        tf_listasimples_posicao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tf_listasimples_posicaoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ListaSimplesLayout = new javax.swing.GroupLayout(ListaSimples);
        ListaSimples.setLayout(ListaSimplesLayout);
        ListaSimplesLayout.setHorizontalGroup(
            ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ListaSimplesLayout.createSequentialGroup()
                .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ListaSimplesLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(ListaSimplesLayout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tf_principal_listasimples, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ListaSimplesLayout.createSequentialGroup()
                                .addComponent(ls_radio_posi)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(tf_listasimples_posicao)
                                .addGap(18, 18, 18)
                                .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(cancel_simples)
                                    .addGroup(ListaSimplesLayout.createSequentialGroup()
                                        .addComponent(ls_radio_inicio)
                                        .addGap(18, 18, 18)
                                        .addComponent(ls_radio_fim)))))
                        .addGap(0, 24, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ListaSimplesLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(salva_simples)))
                .addContainerGap())
        );
        ListaSimplesLayout.setVerticalGroup(
            ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ListaSimplesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(tf_principal_listasimples, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ls_radio_inicio)
                    .addComponent(ls_radio_fim)
                    .addComponent(ls_radio_posi)
                    .addComponent(tf_listasimples_posicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 252, Short.MAX_VALUE)
                .addGroup(ListaSimplesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salva_simples)
                    .addComponent(cancel_simples))
                .addContainerGap())
        );

        Root.add(ListaSimples, "ListaSimples");

        jLabel5.setText("Nome");

        jLabel8.setText("Posição");

        check_ls_dupla_inicio.setText("Inicio");

        check_ls_dupla_fim.setText("Fim");

        salva_dupla.setText("Salvar");

        cancel_dupla.setText("Cancelar");
        cancel_dupla.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_duplaActionPerformed(evt);
            }
        });

        remove_dupla.setText("Remover");
        remove_dupla.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                remove_duplaActionPerformed(evt);
            }
        });

        check_ls_dupla_posi.setText("Posição");
        check_ls_dupla_posi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                check_ls_dupla_posiActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ListaDuplaLayout = new javax.swing.GroupLayout(ListaDupla);
        ListaDupla.setLayout(ListaDuplaLayout);
        ListaDuplaLayout.setHorizontalGroup(
            ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ListaDuplaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ListaDuplaLayout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tf_listadupla, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(ListaDuplaLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(text_posic_dupla, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(check_ls_dupla_inicio)
                        .addGap(18, 18, 18)
                        .addGroup(ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cancel_dupla)
                            .addComponent(check_ls_dupla_fim))))
                .addContainerGap(36, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ListaDuplaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(salva_dupla)
                .addContainerGap())
        );
        ListaDuplaLayout.setVerticalGroup(
            ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ListaDuplaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(tf_listadupla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(text_posic_dupla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(check_ls_dupla_inicio)
                    .addComponent(check_ls_dupla_fim))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 252, Short.MAX_VALUE)
                .addGroup(ListaDuplaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salva_dupla)
                    .addComponent(cancel_dupla))
                .addContainerGap())
        );

        Root.add(ListaDupla, "ListaDupla");

        salvar_piha.setText("Salvar");
        salvar_piha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvar_pihaActionPerformed(evt);
            }
        });

        cancel_pilha.setText("Cancelar");
        cancel_pilha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_pilhaActionPerformed(evt);
            }
        });

        jLabel7.setText("Nome");

        remove_pilha.setText("Remover");
        remove_pilha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                remove_pilhaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PilhaLayout = new javax.swing.GroupLayout(Pilha);
        Pilha.setLayout(PilhaLayout);
        PilhaLayout.setHorizontalGroup(
            PilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PilhaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PilhaLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(cancel_pilha)
                        .addGap(28, 28, 28)
                        .addComponent(salvar_piha))
                    .addGroup(PilhaLayout.createSequentialGroup()
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tf_pilha, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 24, Short.MAX_VALUE)))
                .addContainerGap())
        );
        PilhaLayout.setVerticalGroup(
            PilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PilhaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(tf_pilha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 298, Short.MAX_VALUE)
                .addGroup(PilhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salvar_piha)
                    .addComponent(cancel_pilha))
                .addContainerGap())
        );

        Root.add(Pilha, "Pilha");

        jLabel2.setText("Nome");

        salvar_fila.setText("Salvar");
        salvar_fila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvar_filaActionPerformed(evt);
            }
        });

        cancel_fila.setText("Cancelar");
        cancel_fila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_filaActionPerformed(evt);
            }
        });

        remove_fila.setText("Remover");
        remove_fila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                remove_filaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout FilaLayout = new javax.swing.GroupLayout(Fila);
        Fila.setLayout(FilaLayout);
        FilaLayout.setHorizontalGroup(
            FilaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(FilaLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tf_fila, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(36, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, FilaLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(cancel_fila)
                .addGap(18, 18, 18)
                .addComponent(salvar_fila)
                .addContainerGap())
        );
        FilaLayout.setVerticalGroup(
            FilaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(FilaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(FilaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(tf_fila, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 298, Short.MAX_VALUE)
                .addGroup(FilaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salvar_fila)
                    .addComponent(cancel_fila))
                .addContainerGap())
        );

        Root.add(Fila, "Fila");

        jLabel9.setText("Nome");
        ListaCircular.add(jLabel9);

        tf_circular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                circular_textfieldActionPerformed(evt);
            }
        });
        ListaCircular.add(tf_circular);

        jLabel10.setText("Posição");
        ListaCircular.add(jLabel10);

        cancel_circular.setText("Cancelar");
        cancel_circular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_circularActionPerformed(evt);
            }
        });
        ListaCircular.add(cancel_circular);

        circular_salvar.setText("Salvar");
        circular_salvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                circula_removerActionPerformed(evt);
            }
        });
        ListaCircular.add(circular_salvar);

        tf_circular_pos.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#####"))));
        tf_circular_pos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                circular_salvarActionPerformed(evt);
            }
        });
        ListaCircular.add(tf_circular_pos);

        Root.add(ListaCircular, "ListaCircular");

        jLabel1.setText("Nome da pasta");

        tf_salvarestrutura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tf_salvarestruturaActionPerformed(evt);
            }
        });

        check_listasimples.setText("Lista Simplesmente Encadeada");
        check_listasimples.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                check_listasimplesActionPerformed(evt);
            }
        });

        check_listadupla.setText("Lista Duplamente Encadeada");
        check_listadupla.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                check_listaduplaActionPerformed(evt);
            }
        });

        check_circular.setText("Lista Circular");

        check_pilha.setText("Pilha");

        check_fila.setText("Fila");

        salvar_salvarestrutura.setText("Salvar");
        salvar_salvarestrutura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvar_salvarestruturaActionPerformed(evt);
            }
        });

        cancel_salvarestrutura.setText("Cancelar");
        cancel_salvarestrutura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancel_salvarestruturaActionPerformed(evt);
            }
        });

        check_bolha.setText("BubbleSort");

        check_quick.setText("QuickSort");

        check_inserton.setText("InsertionSort");

        check_selection.setText("SelectionSort");

        javax.swing.GroupLayout SalvarEstruturaLayout = new javax.swing.GroupLayout(SalvarEstrutura);
        SalvarEstrutura.setLayout(SalvarEstruturaLayout);
        SalvarEstruturaLayout.setHorizontalGroup(
            SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tf_salvarestrutura))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, SalvarEstruturaLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(cancel_salvarestrutura)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(salvar_salvarestrutura))
                    .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                        .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(check_listasimples)
                            .addComponent(check_listadupla)
                            .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                                .addComponent(check_circular)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(check_pilha)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(check_fila))
                            .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(check_selection)
                                    .addComponent(check_quick))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(check_bolha)
                                    .addComponent(check_inserton))))
                        .addGap(0, 135, Short.MAX_VALUE)))
                .addContainerGap())
        );
        SalvarEstruturaLayout.setVerticalGroup(
            SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SalvarEstruturaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(tf_salvarestrutura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(check_listasimples)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(check_listadupla)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(check_circular)
                    .addComponent(check_pilha)
                    .addComponent(check_fila))
                .addGap(18, 18, 18)
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(check_quick)
                    .addComponent(check_bolha))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(check_selection)
                    .addComponent(check_inserton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 124, Short.MAX_VALUE)
                .addGroup(SalvarEstruturaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salvar_salvarestrutura)
                    .addComponent(cancel_salvarestrutura))
                .addContainerGap())
        );

        Root.add(SalvarEstrutura, "SalvarEstrutura");

        tabela.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Estrutura", "Nome", ""
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Object.class, java.lang.Boolean.class
            };
            boolean[] canEdit = new boolean [] {
                true, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tabela.setColumnSelectionAllowed(true);
        tabela.setDragEnabled(true);
        tabela.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                tabelaAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });
        jScrollPane1.setViewportView(tabela);
        tabela.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        tabela.getColumnModel().getColumn(0).setMinWidth(150);
        tabela.getColumnModel().getColumn(0).setPreferredWidth(150);
        tabela.getColumnModel().getColumn(0).setMaxWidth(150);
        tabela.getColumnModel().getColumn(1).setMinWidth(150);
        tabela.getColumnModel().getColumn(1).setPreferredWidth(150);
        tabela.getColumnModel().getColumn(1).setMaxWidth(150);
        tabela.getColumnModel().getColumn(2).setResizable(false);
        tabela.getColumnModel().getColumn(2).setPreferredWidth(100);
        tabela.getAccessibleContext().setAccessibleParent(Exibe);

        abrir_elemento.setText("Abrir");
        abrir_elemento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                abrir_elementoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout ExibeLayout = new javax.swing.GroupLayout(Exibe);
        Exibe.setLayout(ExibeLayout);
        ExibeLayout.setHorizontalGroup(
            ExibeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ExibeLayout.createSequentialGroup()
                .addGap(72, 72, 72)
                .addComponent(abrir_elemento, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(258, Short.MAX_VALUE))
            .addGroup(ExibeLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
        );
        ExibeLayout.setVerticalGroup(
            ExibeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ExibeLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                .addComponent(abrir_elemento)
                .addGap(29, 29, 29))
        );

        Root.add(Exibe, "Exibe");

        Exibe_Arquivos.setPreferredSize(new java.awt.Dimension(401, 332));

        janela.setApproveButtonText("Salvar");
        janela.setApproveButtonToolTipText("");
        janela.setCurrentDirectory(new java.io.File("/home/jorge/NetBeansProjects/projaed/src/estruturas"));
        janela.setDialogTitle("Janela"); // NOI18N
        janela.setFileSelectionMode(javax.swing.JFileChooser.FILES_AND_DIRECTORIES);
        janela.setToolTipText("");
        janela.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        janela.setDoubleBuffered(true);
        janela.setDragEnabled(true);
        janela.setMultiSelectionEnabled(true);
        janela.setName("janela"); // NOI18N
        janela.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                janelaMouseClicked(evt);
            }
        });
        janela.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                janelaActionPerformed(evt);
            }
        });
        janela.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                janelaKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout Exibe_ArquivosLayout = new javax.swing.GroupLayout(Exibe_Arquivos);
        Exibe_Arquivos.setLayout(Exibe_ArquivosLayout);
        Exibe_ArquivosLayout.setHorizontalGroup(
            Exibe_ArquivosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(janela, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
        );
        Exibe_ArquivosLayout.setVerticalGroup(
            Exibe_ArquivosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Exibe_ArquivosLayout.createSequentialGroup()
                .addComponent(janela, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 48, Short.MAX_VALUE))
        );

        janela.getAccessibleContext().setAccessibleName("");

        Root.add(Exibe_Arquivos, "Exibe_Arquivos");

        jMenu_Cria.setText("Criar");

        jRadioButtonMenuItem1.setSelected(true);
        jRadioButtonMenuItem1.setText("Fila");
        jRadioButtonMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem1ActionPerformed(evt);
            }
        });
        jMenu_Cria.add(jRadioButtonMenuItem1);

        jRadioButtonMenuItem2.setSelected(true);
        jRadioButtonMenuItem2.setText("Pilha");
        jRadioButtonMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem2ActionPerformed(evt);
            }
        });
        jMenu_Cria.add(jRadioButtonMenuItem2);
        jMenu_Cria.add(jSeparator1);

        jMenu3.setText("Lista");

        princ_listasimples.setSelected(true);
        princ_listasimples.setText("Simples");
        princ_listasimples.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                princ_listasimplesActionPerformed(evt);
            }
        });
        jMenu3.add(princ_listasimples);

        princ_listadupla.setSelected(true);
        princ_listadupla.setText("Dupla");
        princ_listadupla.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                princ_listaduplaActionPerformed(evt);
            }
        });
        jMenu3.add(princ_listadupla);

        jRadioButtonMenuItem5.setSelected(true);
        jRadioButtonMenuItem5.setText("Circular");
        jRadioButtonMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem5ActionPerformed(evt);
            }
        });
        jMenu3.add(jRadioButtonMenuItem5);

        jMenu_Cria.add(jMenu3);

        jMenuBar1.add(jMenu_Cria);

        jMenu2_Salva.setText("Salvar Estrutura");

        jRadioButtonMenuItem6.setSelected(true);
        jRadioButtonMenuItem6.setText("Salvar");
        jRadioButtonMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2_Salva.add(jRadioButtonMenuItem6);

        jMenuBar1.add(jMenu2_Salva);

        jMenu_esvazia.setText("Esvaziar Estrutura");

        jRadioButtonMenuItem7.setSelected(true);
        jRadioButtonMenuItem7.setText("Pilha");
        jRadioButtonMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem7ActionPerformed(evt);
            }
        });
        jMenu_esvazia.add(jRadioButtonMenuItem7);

        jRadioButtonMenuItem8.setSelected(true);
        jRadioButtonMenuItem8.setText("Fila");
        jRadioButtonMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem8ActionPerformed(evt);
            }
        });
        jMenu_esvazia.add(jRadioButtonMenuItem8);

        jMenu5.setText("Lista");

        jRadioButtonMenuItem9.setSelected(true);
        jRadioButtonMenuItem9.setText("Simples");
        jRadioButtonMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem9ActionPerformed(evt);
            }
        });
        jMenu5.add(jRadioButtonMenuItem9);

        jRadioButtonMenuItem10.setSelected(true);
        jRadioButtonMenuItem10.setText("Dupla");
        jRadioButtonMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem10ActionPerformed(evt);
            }
        });
        jMenu5.add(jRadioButtonMenuItem10);

        jRadioButtonMenuItem11.setSelected(true);
        jRadioButtonMenuItem11.setText("Circular");
        jRadioButtonMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jRadioButtonMenuItem11ActionPerformed(evt);
            }
        });
        jMenu5.add(jRadioButtonMenuItem11);

        jMenu_esvazia.add(jMenu5);

        jMenuBar1.add(jMenu_esvazia);

        Menu_Exibe.setText("Exibir");

        Menu_exibe_todos.setText("Todos");
        Menu_exibe_todos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Menu_exibe_todosActionPerformed(evt);
            }
        });
        Menu_Exibe.add(Menu_exibe_todos);

        jMenuBar1.add(Menu_Exibe);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Root, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(Root, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jRadioButtonMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem1ActionPerformed
        // TODO add your handling code here:
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Fila");
    }//GEN-LAST:event_jRadioButtonMenuItem1ActionPerformed
    private void jRadioButtonMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem2ActionPerformed
        // TODO add your handling code here:

        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Pilha");

    }//GEN-LAST:event_jRadioButtonMenuItem2ActionPerformed
    private void princ_listasimplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_princ_listasimplesActionPerformed
        // TODO add your handling code here:
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "ListaSimples");
    }//GEN-LAST:event_princ_listasimplesActionPerformed
    private void princ_listaduplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_princ_listaduplaActionPerformed
        // TODO add your handling code here:
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "ListaDupla");
    }//GEN-LAST:event_princ_listaduplaActionPerformed
    private void jRadioButtonMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem5ActionPerformed
        // TODO add your handling code here:
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "ListaCircular");
    }//GEN-LAST:event_jRadioButtonMenuItem5ActionPerformed
    private void salvar_pihaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvar_pihaActionPerformed
        if (tf_pilha.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome vazio!");
        } else {
            String str = tf_pilha.getText();

            if (str == null) {
                JOptionPane.showMessageDialog(null, "Campos devem ser preenchidos");
            } else {
                if (evt.getSource() == salvar_piha && control.tamanhoEstrutura() == 0) {
                    pilha.inserirFim(str);
                } else {
                    pilha.inserirComeco(str);
                }

                tf_pilha.setText("");
                if (evt.getSource() == salvar_piha) {
                    pilha.inserirComeco(str);

                    JOptionPane.showMessageDialog(null, "Elemento inserido com sucesso.");
                    pilha.imprimeElementos();
                }
            }
        }
    }//GEN-LAST:event_salvar_pihaActionPerformed
    private void jRadioButtonMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem6ActionPerformed
        // TODO add your handling code here:
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "SalvarEstrutura");
        //OK!
    }//GEN-LAST:event_jRadioButtonMenuItem6ActionPerformed
    private void cancel_simplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_simplesActionPerformed
        // TODO add your handling code here:
        //botão cancelar fila
        if (evt.getSource() == cancel_simples) {
            tf_listasimples_posicao.setText(" ");
            tf_principal_listasimples.setText(" ");
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }
    }//GEN-LAST:event_cancel_simplesActionPerformed
    private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
        // TODO add your handling code here:
        opcao = JOptionPane.showConfirmDialog(null, "Deseja sair do programa...?", "Confirma ?", JOptionPane.CANCEL_OPTION);
        if (opcao == 0) {
            dispose();
        } else if (opcao == 1 || opcao == 2) {
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }
    }//GEN-LAST:event_jButton19ActionPerformed
    private void cancel_duplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_duplaActionPerformed
        // TODO add your handling code here:
        tf_listadupla.setText(" ");
        text_posic_dupla.setText(" ");
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Inicio");

    }//GEN-LAST:event_cancel_duplaActionPerformed
    private void cancel_pilhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_pilhaActionPerformed
        // TODO add your handling code here:

        if (evt.getSource() == cancel_pilha) {
            tf_pilha.setText(" ");
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }

        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Inicio");

    }//GEN-LAST:event_cancel_pilhaActionPerformed
    private void cancel_filaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_filaActionPerformed
        // TODO add your handling code here:
        if (evt.getSource() == cancel_fila) {
            tf_fila.setText(" ");
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }
    }//GEN-LAST:event_cancel_filaActionPerformed
    private void cancel_circularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_circularActionPerformed
        // TODO add your handling code here:
        if (evt.getSource() == cancel_circular) {
            tf_circular.setText(" ");
            tf_circular_pos.setText(" ");
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }
    }//GEN-LAST:event_cancel_circularActionPerformed
    private void cancel_salvarestruturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancel_salvarestruturaActionPerformed
        if (evt.getSource() == cancel_salvarestrutura) {
            check_bolha.setSelected(false);
            check_circular.setSelected(false);
            check_inserton.setSelected(false);
            check_quick.setSelected(false);
            check_selection.setSelected(false);
            check_fila.setSelected(false);
            check_listasimples.setSelected(false);
            check_listadupla.setSelected(false);
            check_pilha.setSelected(false);
            tf_salvarestrutura.setText(" ");
            CardLayout card = (CardLayout) Root.getLayout();
            card.show(Root, "Inicio");
        }
    }//GEN-LAST:event_cancel_salvarestruturaActionPerformed
    private void salvar_salvarestruturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvar_salvarestruturaActionPerformed
        // PAINEL SALVAR ESTRUTURA
        if (tf_salvarestrutura.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome vazio!");
        } else {
            opcao = JOptionPane.showConfirmDialog(null, "Deseja Salvar uma outra estrutura", "Confirma ?", JOptionPane.CANCEL_OPTION);
            String nomeDiretorio = tf_salvarestrutura.getText();
            tf_salvarestrutura.setText("");
            arquivos.criarEstrutura(nomeDiretorio, "Controlador");
            if (check_fila.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "Fila");
            }
            check_fila.setSelected(false);
            if (check_pilha.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "Pilha");
            }
            check_pilha.setSelected(false);
            if (check_listasimples.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "ListaSimples");
            }
            check_listasimples.setSelected(false);
            if (check_listadupla.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "ListaDupla");
            }
            check_listadupla.setSelected(false);
            if (check_circular.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "ListaCircular");
            }
            check_circular.setSelected(false);
            if (check_bolha.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "BubbleSort");
            }
            check_bolha.setSelected(false);
            if (check_quick.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "QuickSort");
            }
            check_quick.setSelected(false);
            if (check_selection.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "SelectionSort");
            }
            check_selection.setSelected(false);
            if (check_inserton.isSelected()) {
                arquivos.criarEstrutura(nomeDiretorio, "InsertionSort");
                check_inserton.setSelected(false);
            } else if (opcao == 0) {
                CardLayout card = (CardLayout) Root.getLayout();
                card.show(Root, "SalvarEsrutura");
            } else if (opcao == 1 || opcao == 2) {
                CardLayout card = (CardLayout) Root.getLayout();
                card.show(Root, "Inicio");
            }

        }
    }//GEN-LAST:event_salvar_salvarestruturaActionPerformed
    private void salva_simplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salva_simplesActionPerformed

        Aluno aluno = new Aluno();
        nome = tf_principal_listasimples.getText();
        aluno.setNome(nome);
        if (evt.getSource() == salva_simples) {
            if (ls_radio_inicio.isSelected()) {
                listaSimples.inserirComeco((Object) aluno);
            } else if (ls_radio_fim.isSelected()) {
                listaSimples.inserirFim((Object) aluno);
            } else if (ls_radio_posi.isSelected()) {
                int posicao = Integer.parseInt(tf_listasimples_posicao.getText());
                listaSimples.inserirPosicaoLista(posicao, aluno);
            }
            tf_principal_listasimples.setText(" ");
            tf_listasimples_posicao.setText(" ");
            opcao = JOptionPane.showConfirmDialog(null, "Inserir Novamente?", "Confirma ?", JOptionPane.CANCEL_OPTION);
            if (opcao == 0) {
                tf_listasimples_posicao.setText(" ");
                tf_principal_listasimples.setText(" ");
                CardLayout card = (CardLayout) Root.getLayout();
                card.show(Root, "ListaSimples");
            } else if (opcao == 1 || opcao == 2) {
                CardLayout card = (CardLayout) Root.getLayout();
                card.show(Root, "Inicio");
            }
        }

        Aluno aluno = new Aluno();
        if (salva_simples.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome vazio!");
        } else {
            nome = tf_principal_listasimples.getText();
            aluno.setNome(nome);
            if (ls_radio_fim.isSelected()) {
                listaSimples.inserirFim(aluno);
            } else if (ls_radio_inicio.isSelected()) {
                listaSimples.inserirComeco(aluno);
            } else if (ls_radio_posi.isSelected()) {
                opcao = Integer.parseInt(tf_listasimples_posicao.getText());
                listaSimples.inserirPosicaoLista(opcao, aluno);
            }
            listaSimples.imprimeElementos();

        }
    }//GEN-LAST:event_salva_simplesActionPerformed
    private void tf_principal_listasimplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_principal_listasimplesActionPerformed
        //TEXT FIELD SALVAR ESTRUTURA
    }//GEN-LAST:event_tf_principal_listasimplesActionPerformed

    private void jRadioButtonMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem9ActionPerformed
        if (evt.getSource() == jRadioButtonMenuItem9) {
            listaSimples.apagaEstrutura();
        }
    }//GEN-LAST:event_jRadioButtonMenuItem9ActionPerformed
    private void tf_listasimples_posicaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_listasimples_posicaoActionPerformed
    }//GEN-LAST:event_tf_listasimples_posicaoActionPerformed
    private void Menu_exibe_todosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Menu_exibe_todosActionPerformed
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Exibe_Arquivos");
        if (evt.getSource() == Menu_exibe_todos) {
            ArrayList<Object> obj = new ArrayList<>();
            for (Object i : obj) {
                obj.addAll((Collection<? extends Object>) fila);
            }
        }
    }//GEN-LAST:event_Menu_exibe_todosActionPerformed
    private void tabelaAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_tabelaAncestorAdded
    }//GEN-LAST:event_tabelaAncestorAdded
    private void abrir_elementoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_abrir_elementoActionPerformed

        ArrayList<Object> objetos = new ArrayList<>();
        if (evt.getSource() == abrir_elemento) {
        }
    }//GEN-LAST:event_abrir_elementoActionPerformed

    private void salva_duplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salva_duplaActionPerformed
        // TODO add your handling code here:
        Aluno aluno = new Aluno();
        if (tf_listadupla.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome vazio!");
        } else {
            nome = tf_listadupla.getText();
            tf_listadupla.setText("");
            aluno.setNome(nome);

            if (check_ls_dupla_fim.isSelected()) {
                listadupla.insereFimListaDupla(aluno);
            } else if (check_ls_dupla_inicio.isSelected()) {
                listadupla.insereComecoListaDupla(aluno);
            } else if (check_ls_dupla_inicio.isSelected()) {
                opcao = Integer.parseInt(text_posic_dupla.getText());
                listadupla.inserePosicaoListaDupla(opcao, aluno);

                if (check_ls_dupla_fim.isSelected()) {
                    listadupla.insereFimListaDupla(aluno);
                } else if (check_ls_dupla_inicio.isSelected()) {
                    listadupla.insereComecoListaDupla(aluno);
                } else if (check_ls_dupla_posi.isSelected()) {
                    opcao = Integer.parseInt(text_posic_dupla.getText());
                    text_posic_dupla.setText("");
                    listadupla.inserePosicaoListaDupla(opcao, aluno);

                }


                JOptionPane.showMessageDialog(null, "Elemento inserido com sucesso!");
                listadupla.imprimeElementos();
            }
    }//GEN-LAST:event_salva_duplaActionPerformed
    private void check_ls_dupla_fimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_ls_dupla_fimActionPerformed
       
        
        // TODO add your handling code here:
    }//GEN-LAST:event_check_ls_dupla_fimActionPerformed
    private void tf_listaduplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_listaduplaActionPerformed
    }//GEN-LAST:event_tf_listaduplaActionPerformed
    private void check_ls_dupla_inicioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_ls_dupla_inicioActionPerformed
    }//GEN-LAST:event_check_ls_dupla_inicioActionPerformed
    private void check_ls_dupla_posiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_ls_dupla_posiActionPerformed
    }//GEN-LAST:event_check_ls_dupla_posiActionPerformed

    private void text_posic_duplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_text_posic_duplaActionPerformed
    }//GEN-LAST:event_text_posic_duplaActionPerformed

    private void salvar_filaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvar_filaActionPerformed

        String str = tf_fila.getText();
        if (evt.getSource() == salvar_fila && control.tamanhoEstrutura() == 0) {
            fila.inserirComeco(str);
        } else {
            fila.inserirFim(str);
        }
        CardLayout card = (CardLayout) Root.getLayout();
        card.show(Root, "Inicio");
        if (tf_fila.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome vazio!");
        } else {
            String str = tf_fila.getText();
            tf_fila.setText("");
            if (evt.getSource() == salvar_fila) {
                fila.inserirComeco(str);
                JOptionPane.showMessageDialog(null, "Elemento inserido com sucesso.");
                fila.imprimeElementos();
            }
        }
    }//GEN-LAST:event_salvar_filaActionPerformed

    private void check_bolhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_bolhaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_check_bolhaActionPerformed

    private void circular_salvarActionPerformed(java.awt.event.ActionEvent evt) {                                                

        if (evt.getSource() == circular_salvar) {
            Aluno aluno = new Aluno();
            nome = tf_circular.getText();
            aluno.setNome(nome);
            if (tf_circular.equals(" ") || tf_circular_pos.equals(" ")) {
                JOptionPane.showMessageDialog(null, "Informe posição e elemento da lista");

            }
            int pos = Integer.parseInt(tf_circular_pos.getText());
            listacircular.insereListaCircular(pos, aluno);
            tf_circular.setText(" ");
            tf_circular_pos.setText(" ");

        }
    }                                               
    private void janelaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_janelaMouseClicked
        if (evt.getClickCount() == 2) {
        }

    }//GEN-LAST:event_janelaMouseClicked

    private void janelaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_janelaKeyPressed
        if (evt.getSource() == evt.VK_ENTER) {
        }

        // TODO add your handling code here:
    }//GEN-LAST:event_janelaKeyPressed

    private void janelaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_janelaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_janelaActionPerformed

    private void circula_removerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_circula_removerActionPerformed
        // TODO add your handling code here:
        if (circular_posicao.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome ou posição vazios!");
        } else {
            String nome = circular_textfield.getText();
            circular_textfield.setText("");
            int posicao = Integer.parseInt(circular_posicao.getText());
            circular_posicao.setText("");
            listacircular.removeElementoListaCircular(posicao);
            listacircular.imprimeElementos();
        }
    }//GEN-LAST:event_circula_removerActionPerformed

    private void circular_salvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_circular_salvarActionPerformed
        // TODO add your handling code here:
        if (circular_textfield.getText().equals("") || circular_posicao.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Nome ou posição vazios!");
        } else {
            String nome = circular_textfield.getText();
            circular_textfield.setText("");
            int posicao = Integer.parseInt(circular_posicao.getText());
            circular_posicao.setText("");
            listacircular.insereListaCircular(posicao, nome);
            JOptionPane.showMessageDialog(rootPane, "Objeto salvo com sucesso!");
            listacircular.imprimeElementos();
        }
    }//GEN-LAST:event_circular_salvarActionPerformed

    private void circular_textfieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_circular_textfieldActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_circular_textfieldActionPerformed

    private void tf_salvarestruturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tf_salvarestruturaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_tf_salvarestruturaActionPerformed

    private void remove_pilhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove_pilhaActionPerformed
        // TODO add your handling code here:
        if (evt.getSource() == remove_pilha) {
            pilha.removerComeco();
            pilha.imprimeElementos();
        }
    }//GEN-LAST:event_remove_pilhaActionPerformed

    private void remove_duplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove_duplaActionPerformed
        // TODO add your handling code here:
        if (check_ls_dupla_fim.isSelected()) {
            listadupla.removerFim();
        } else if (check_ls_dupla_inicio.isSelected()) {
            listadupla.removerFim();
        } else if (check_ls_dupla_posi.isSelected()) {
            opcao = Integer.parseInt(text_posic_dupla.getText());
            //text_posic_dupla.setText("");
            listadupla.removeElementoPosicaoListaDupla(opcao);
        }
        listadupla.imprimeElementos();
    }//GEN-LAST:event_remove_duplaActionPerformed

    private void remove_filaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_remove_filaActionPerformed
        // TODO add your handling code here:
        if (evt.getSource() == remove_fila) {
            fila.removerFim();
            fila.imprimeElementos();
        }
    }//GEN-LAST:event_remove_filaActionPerformed

    private void jRadioButtonMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem7ActionPerformed
        // TODO add your handling code here:
        pilha.apagaEstrutura();
        pilha.imprimeElementos();
    }//GEN-LAST:event_jRadioButtonMenuItem7ActionPerformed

    private void jRadioButtonMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem8ActionPerformed
        // TODO add your handling code here:
        pilha.apagaEstrutura();
    }//GEN-LAST:event_jRadioButtonMenuItem8ActionPerformed

    private void jRadioButtonMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem10ActionPerformed
        // TODO add your handling code here:
        listadupla.apagaEstrutura();
    }//GEN-LAST:event_jRadioButtonMenuItem10ActionPerformed

    private void jRadioButtonMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButtonMenuItem11ActionPerformed
        // TODO add your handling code here:
        listacircular.apagaEstrutura();
    }//GEN-LAST:event_jRadioButtonMenuItem11ActionPerformed

    private void check_listaduplaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_listaduplaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_check_listaduplaActionPerformed

    private void check_listasimplesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_check_listasimplesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_check_listasimplesActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;


                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaPrincipal.class
                    .getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Exibe;
    private javax.swing.JPanel Exibe_Arquivos;
    private javax.swing.JPanel Fila;
    private javax.swing.JPanel Inicio;
    private javax.swing.JPanel ListaCircular;
    private javax.swing.JPanel ListaDupla;
    private javax.swing.JPanel ListaSimples;
    private javax.swing.JMenu Menu_Exibe;
    private javax.swing.JMenuItem Menu_exibe_todos;
    private javax.swing.JPanel Pilha;
    private javax.swing.JPanel Root;
    private javax.swing.JPanel SalvarEstrutura;
    private javax.swing.JButton abrir_elemento;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton cancel_circular;
    private javax.swing.JButton cancel_dupla;
    private javax.swing.JButton cancel_fila;
    private javax.swing.JButton cancel_pilha;
    private javax.swing.JButton cancel_salvarestrutura;
    private javax.swing.JButton cancel_simples;
    private javax.swing.JCheckBox check_bolha;
    private javax.swing.JCheckBox check_circular;
    private javax.swing.JCheckBox check_fila;
    private javax.swing.JCheckBox check_inserton;
    private javax.swing.JCheckBox check_listadupla;
    private javax.swing.JCheckBox check_listasimples;
    private javax.swing.JRadioButton check_ls_dupla_fim;
    private javax.swing.JRadioButton check_ls_dupla_inicio;
    private javax.swing.JRadioButton check_ls_dupla_posi;
    private javax.swing.JCheckBox check_pilha;
    private javax.swing.JCheckBox check_quick;
    private javax.swing.JCheckBox check_selection;
    private javax.swing.JButton circular_salvar;
    private javax.swing.JButton jButton19;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu2_Salva;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu jMenu_Cria;
    private javax.swing.JMenu jMenu_esvazia;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem10;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem11;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem5;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem6;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem7;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem8;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JFileChooser janela;
    private javax.swing.JRadioButton ls_radio_fim;
    private javax.swing.JRadioButton ls_radio_inicio;
    private javax.swing.JRadioButton ls_radio_posi;
    private javax.swing.JRadioButtonMenuItem princ_listadupla;
    private javax.swing.JRadioButtonMenuItem princ_listasimples;
    private javax.swing.JButton remove_dupla;
    private javax.swing.JButton remove_fila;
    private javax.swing.JButton remove_pilha;
    private javax.swing.JButton salva_dupla;
    private javax.swing.JButton salva_simples;
    private javax.swing.JButton salvar_fila;
    private javax.swing.JButton salvar_piha;
    private javax.swing.JButton salvar_salvarestrutura;
    private javax.swing.JTable tabela;
    private javax.swing.JTextField text_posic_dupla;
    private javax.swing.JTextField tf_circular;
    private javax.swing.JFormattedTextField tf_circular_pos;
    private javax.swing.JTextField tf_fila;
    private javax.swing.JTextField tf_listadupla;
    private javax.swing.JFormattedTextField tf_listasimples_posicao;
    private javax.swing.JTextField tf_pilha;
    private javax.swing.JTextField tf_principal_listasimples;
    private javax.swing.JTextField tf_salvarestrutura;
    // End of variables declaration//GEN-END:variables
}
